import request from "@/utils/request";

// 获取本账户全局模型数据树
export function getSelfGlobalDataTree() {
  return request({
    url: "/model/globalData/getSelfGlobalDataTree",
    method: "get",
  });
}

// 获取共享账户全局模型数据树
export function getSharedAccountGlobalDataTree() {
  return request({
    url: "/model/globalData/getSharedAccountGlobalDataTree",
    method: "get",
  });
}

// 移动树节点的位置(全局模型树)
export function globalDataMoveTreeNode(data) {
  return request({
    url: "/model/globalData/moveTreeNode",
    method: "post",
    data: data,
  });
}

// 新增全局模型数据
export function addGlobalData(data) {
  return request({
    url: "/model/globalData",
    method: "post",
    data: data,
  });
}

// 获取全局模型数据详细信息
export function getGlobalDataInfo(id) {
  return request({
    url: "/model/globalData/" + id,
    method: "get",
  });
}

// 修改全局模型数据
export function updateGlobalData(data) {
  return request({
    url: "/model/globalData",
    method: "put",
    data: data,
  });
}

// 删除全局模型数据
export function deleGlobalData(ids) {
  return request({
    url: "/model/globalData/" + ids,
    method: "delete",
  });
}
// 校验类别代号是否重复
export function globalDataCheckCodeUnique(query) {
  return request({
    url: "/model/globalData/checkCodeUnique",
    method: "get",
    params: query,
  });
}

// 查询本账户模型列表
export function getSelfModelTree() {
  return request({
    url: "/model/model/getSelfModelTree",
    method: "get",
  });
}
// 查询共享账户模型列表
export function getSharedModelTree() {
  return request({
    url: "/model/model/getSharedAccountModelTree",
    method: "get",
  });
}

// 新增模型
export function addModel(data) {
  return request({
    url: "/model/model/",
    method: "post",
    data: data,
  });
}
// 获取模型详细信息
export function getModelInfo(id) {
  return request({
    url: "/model/model/" + id,
    method: "get",
  });
}
// 修改模型
export function updateModel(data) {
  return request({
    url: "/model/model/",
    method: "put",
    data: data,
  });
}

// 修改模型文件
export function updateModelFile(data) {
  return request({
    url: "/model/model/updateModelFile/",
    method: "put",
    data: data,
  });
}

// 删除模型
export function deleModel(ids) {
  return request({
    url: "/model/model/" + ids,
    method: "delete",
  });
}

// 移动树节点的位置(本地账户模型树)
export function moveTreeNodeOrder(data) {
  return request({
    url: "/model/model/moveTreeNodeWithOrderList",
    method: "post",
    data: data,
  });
}

// 获取当前模型已选中的用户列表
export function getSelectedUsersList(query) {
  return request({
    url: "/model/modelShare/getSelectedUsersList",
    method: "get",
    params: query,
  });
}
// 获取可选择的共享账户列表
export function getShareAccountList(query) {
  return request({
    url: "/system/user/listExcludeSelf",
    method: "get",
    params: query,
  });
}
// 新增模型的共享账户列表
export function addModelShare(data) {
  return request({
    url: "/model/modelShare/",
    method: "post",
    data: data,
  });
}

// 获取模型库的模型树
export function getThreeDimensionFileTree() {
  return request({
    url: "/model/threeDimensionFile/getThreeDimensionFileTree",
    method: "get",
  });
}

// 获取树节点的三维模型列表
export function getThreeDimensionFileList(query) {
  return request({
    url: "/model/threeDimensionFile/getThreeDimensionFileList",
    method: "get",
    params: query,
  });
}

// 当前节点上传三维模型
export function uploadThreeDimensionFile(data) {
  return request({
    url: "/model/threeDimensionFile/",
    method: "post",
    data: data,
  });
}
// 合并上传接口，获取文件上传成功后返回的结果
export function mergeFile(query) {
  return request({
    url: "/common/mergeFile",
    headers: {
      repeatSubmit: false, //前端不校验重复提交
    },
    method: "post",
    params: query,
  });
}
// 移动树节点的位置(三维模型树)
export function moveTreeNode(data) {
  return request({
    url: "/model/threeDimensionFile/moveTreeNode",
    method: "post",
    data: data,
  });
}
// 新增文件夹(三维模型库)
export function addModelFolder(data) {
  return request({
    url: "/model/threeDimensionFile/",
    method: "post",
    data: data,
  });
}

// 修改文件夹(三维模型库)
export function updateModelFolder(data) {
  return request({
    url: "/model/threeDimensionFile/",
    method: "put",
    data: data,
  });
}

// 删除文件夹(三维模型库)
export function deleModelFolder(ids) {
  return request({
    url: "/model/threeDimensionFile/" + ids,
    method: "delete",
  });
}

// 获取三维模型的详细信息
export function getThreeDimensionFile(fileId) {
  return request({
    url: "/model/threeDimensionFile/" + fileId,
    method: "get",
  });
}

// 校验类别代号是否重复
export function checkCodeUnique(query) {
  return request({
    url: "/model/model/checkCodeUnique",
    method: "get",
    params: query,
  });
}

// 版本 获取版本列表
export function getMainVersionList(query) {
  return request({
    url: "/model/mainVersion/list",
    method: "get",
    params: query,
  });
}

// 版本 设置默认版本
export function setDefaultMainVersion(query) {
  return request({
    url: "/model/mainVersion/setDefaultVersion",
    method: "get",
    params: query,
  });
}
// 版本 新增版本
export function addMainVersion(data) {
  return request({
    url: "/model/mainVersion/",
    method: "post",
    data: data,
  });
}

// 版本 修改版本
export function updateMainVersion(data) {
  return request({
    url: "/model/mainVersion/",
    method: "put",
    data: data,
  });
}

// 版本 删除版本
export function delMainVersion(id) {
  return request({
    url: "/model/mainVersion/" + id,
    method: "delete",
  });
}
// 模型动态链接库版本 获取模型动态链接库
export function getDllList(query) {
  return request({
    url: "/model/dll/list",
    method: "get",
    params: query,
  });
}

// 模型动态链接库版本 设置默认模型动态链接库版本
export function setDefaultDll(query) {
  return request({
    url: "/model/dll/setDefaultVersion",
    method: "get",
    params: query,
  });
}

// 模型动态链接库版本 新增模型动态链接库版本
export function addDll(data) {
  return request({
    url: "/model/dll/",
    method: "post",
    data: data,
  });
}

// 模型动态链接库版本 修改模型动态链接库版本
export function updateDll(data) {
  return request({
    url: "/model/dll/",
    method: "put",
    data: data,
  });
}

// 模型动态链接库版本 删除模型动态链接库版本
export function delDll(id) {
  return request({
    url: "/model/dll/" + id,
    method: "delete",
  });
}

// 数据建模 获取模型树
export function getModelDataTree(query) {
  return request({
    url: "/model/modelData/getModelDataTree",
    method: "get",
    params: query,
  });
}

// 数据建模 新增模型数据
export function addModelData(data) {
  return request({
    url: "/model/modelData/",
    method: "post",
    data: data,
  });
}

// 数据建模 修改模型数据
export function updateModelData(data) {
  return request({
    url: "/model/modelData/",
    method: "put",
    data: data,
  });
}

// 数据建模 删除模型数据
export function delModelData(modelId, mainVersionId, id) {
  return request({
    url: "/model/modelData/" + modelId + "/" + mainVersionId + "/" + id,
    method: "delete",
  });
}

// 数据建模 移动模型树节点
export function moveTreeNodeModelData(data) {
  return request({
    url: "/model/modelData/moveTreeNode",
    method: "post",
    data: data,
  });
}
// 获取参数化建模列表
export function getModelingList(query) {
  return request({
    url: "/model/modeling/list",
    method: "get",
    params: query,
  });
}
// 获取参数化建模的详细信息
export function getModeling(modelingId) {
  return request({
    url: "/model/modeling/" + modelingId,
    method: "get",
  });
}
// 新增参数化建模
export function addModeling(data) {
  return request({
    url: "/model/modeling/",
    method: "post",
    data: data,
  });
}

// 修改参数化建模
export function updateModeling(data) {
  return request({
    url: "/model/modeling/",
    method: "put",
    data: data,
  });
}

// 删除参数化建模
export function delModeling(ids) {
  return request({
    url: "/model/modeling/" + ids,
    method: "delete",
  });
}

// 导入jsonschema文件
export function importJsonSchema(data) {
  return request({
    url: "/model/modelData/importJsonSchema",
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data: data,
  });
}

// 查询引用列表
export function getQuoteList(query) {
  return request({
    url: "/model/quote/list",
    method: "get",
    params: query,
  });
}

// 查询引用列表中每个引用的详细信息
export function getQuoteInfoById(dataQuoteId) {
  return request({
    url: "/model/quote/" + dataQuoteId,
    method: "get",
  });
}

// 新增数据引用
export function addQuote(data) {
  return request({
    url: "/model/quote/",
    method: "post",
    data: data,
  });
}

// 删除数据引用
export function deleteQuote(dataQuoteId) {
  return request({
    url: "/model/quote/" + dataQuoteId,
    method: "delete",
  });
}

// 数字样机 获取样机列表
export function getDigitalMachineList(query) {
  return request({
    url: "/mock/model-manage-tool/getDigitalMachineList.json",
    method: "get",
    params: query,
    baseURL: "/",
  });
}
